<?php
/**
 * adminPanel - Admin Section for WordPress Vampire plugins
 * 
 * @author Long Nguyen Hai
 * @copyright 2011
 * @since 1.0
 */

class adminPanel{
	
	// constructor
	function adminPanel() {
		global $wv;

		// Add the admin menu
		// add_action( 'admin_menu', array (&$this, 'add_menu') );
		
		// Add the script and style files
		add_action('admin_print_scripts', array(&$this, 'load_scripts') );
		add_action('admin_print_styles', array(&$this, 'load_styles') );

	}
	
	function add_menu()  {	
		add_menu_page( __( 'WV Catalog', 'wv'), __( 'WV Catalog', 'wv' ), 'edit_posts', 'wvc', array (&$this, 'show_menu'), 'div');
		add_submenu_page( 'wvc' , __('Products', 'wv'), __('Products', 'wv'), 'edit_posts', 'wvc', array (&$this, 'show_menu'));
		add_submenu_page( 'wvc' , __('Add Product', 'wv'), __('Add Product', 'wv'), 'edit_posts', 'wvc-add-product', array (&$this, 'show_menu'));
		add_submenu_page( 'wvc' , __('Uninstall', 'wv'), __('Uninstall', 'wv'), 'edit_posts', 'wvc-uninstall', array (&$this, 'show_menu'));
	}
	
	// load the script for the defined page and load only this code	
	function show_menu() {
		global $wv;
				
  		switch ($_GET['page']){
			case 'wvc':

				break;
			default :
				break;
		}
	}
	
	function load_scripts() {
		global $current_screen;
			
		wp_enqueue_script( 'jquery' );	
		
		switch ($current_screen->id) {
			case 'video':
			case 'music':
				wp_enqueue_script( 'jquery-ui', WV_URLPATH . 'admin/js/jquery-ui-1.8.11.custom.min.js' );	
				wp_enqueue_script( 'wvdp', WV_URLPATH . 'admin/js/datepicker.js' );	
				break;
			default:
				# code...
				break;
		}
		
	}
	
	function load_styles() {
		global $current_screen;
		
		wp_enqueue_style( 'wvglobal', WV_URLPATH .'admin/css/global.css' );
		
		switch ($current_screen->id) {
			case 'video':
			case 'music':
				wp_enqueue_style( 'jquery-ui', WV_URLPATH . 'admin/css/smoothness/jquery-ui-1.8.11.custom.css' );	
				break;
			case 'widgets':
                wp_enqueue_style('widgets', WV_URLPATH . 'admin/css/widgets.css');
                break;
			default:
				# code...
				break;
		}
	}
	
}